/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entitybean;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Admin
 */
@Entity
@Table(name = "category_type", catalog = "OnlineShopFourDVD", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "CategoryType.findAll", query = "SELECT c FROM CategoryType c"),
    @NamedQuery(name = "CategoryType.findByCategoryTypeId", query = "SELECT c FROM CategoryType c WHERE c.categoryTypeId = :categoryTypeId"),
    @NamedQuery(name = "CategoryType.findByCategoryTypeName", query = "SELECT c FROM CategoryType c WHERE c.categoryTypeName = :categoryTypeName")})
public class CategoryType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "category_type_id", nullable = false)
    private Integer categoryTypeId;
    @Column(name = "category_type_name", length = 50)
    private String categoryTypeName;
    @OneToMany(mappedBy = "categoryType")
    private Collection<Category> categoryCollection;

    public CategoryType() {
    }

    public CategoryType(Integer categoryTypeId) {
        this.categoryTypeId = categoryTypeId;
    }

    public Integer getCategoryTypeId() {
        return categoryTypeId;
    }

    public void setCategoryTypeId(Integer categoryTypeId) {
        this.categoryTypeId = categoryTypeId;
    }

    public String getCategoryTypeName() {
        return categoryTypeName;
    }

    public void setCategoryTypeName(String categoryTypeName) {
        this.categoryTypeName = categoryTypeName;
    }

    public Collection<Category> getCategoryCollection() {
        return categoryCollection;
    }

    public void setCategoryCollection(Collection<Category> categoryCollection) {
        this.categoryCollection = categoryCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (categoryTypeId != null ? categoryTypeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CategoryType)) {
            return false;
        }
        CategoryType other = (CategoryType) object;
        if ((this.categoryTypeId == null && other.categoryTypeId != null) || (this.categoryTypeId != null && !this.categoryTypeId.equals(other.categoryTypeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entitybean.CategoryType[categoryTypeId=" + categoryTypeId + "]";
    }

}
